
var canvas = document.getElementById("main-canvas");
var RootWindow = new Frame(null, 0, 0, canvas.width, canvas.height);

function get_temporary_context(width, height) {
	var canvas = document.createElement("canvas");
	//~ document.body.appendChild(canvas);
	canvas.width = width;
	canvas.height = height;
	return canvas.getContext("2d");
}

function redraw() {
	var ctx = canvas.getContext("2d");
	ctx.fillStyle = 'rgb(230, 220, 120)';
	ctx.fillRect(0, 0, canvas.width, canvas.height);
	RootWindow.draw(ctx);
	//~ ctx.save();
	//~ ctx.font = "32pt Friz Quadrata TT";
	//~ ctx.textAlign = "center";
	//~ ctx.textBaseline = "alphabetic";
	//~ ctx.fillStyle = "#000000";
	//~ ctx.fillText("World of Warcraft", canvas.width/2, canvas.height/2);
}


window.addEventListener("load", redraw, false);

var button = document.getElementById("button-redraw");
button.addEventListener("click", redraw, false);

var cb = document.getElementById("checkbox-view-frame");
cb.addEventListener("click", function () {
	Frame.prototype._drawFrameContent = this.checked;
	redraw();
}, false);

var cb = document.getElementById("checkbox-use-wowprogramming");
cb.addEventListener("click", function () {
	ImageLoader.setUseWowprogramming(this.checked);
}, false);

